﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StyleMVVM.DependencyInjection;
using StyleMVVM.Validation;

namespace ExampleApp.ViewModels.Validation
{
	[Export(typeof(IFluentRuleProvider<BasicValidationViewModel>))]
	public class FluentValidationForBVVM : IFluentRuleProvider<BasicValidationViewModel>
	{
		public void ProvideRules(IFluentRuleCollection<BasicValidationViewModel> collection)
		{
			collection.AddRule("MiddleNameRule")
			          .Property(x => x.MiddleName)
			          .IsRequired()
			          .When.Property(x => x.FirstName)
			          .IsNotEmpty();
		}
	}
}
